Walkthrough 7-6: Manage metadata for a project
In this walkthrough, you define metadata for the apdev-flights-ws project. You will:
· Review existing metadata for the training4-american-ws project.
· Define new metadata to be used in transformations in the new apdev-flights-ws project.
· Manage metadata.
Starting file
If you did not complete the previous walkthrough, you can get a starting file here. This file is also located in the solutions folder of the student files ZIP located in the Course Resources.
Locate existing metadata in the training4-american-ws project
1. Open the training4-american-ws project.
2. Locate application-types.xml in src/main/resources.
3. Open the file and review the code.
4. Right-click the training4-american-ws project in the Project Explorer and review the options under Mule; you should see two for metadata.
5. Select Mule > Manage Metadata Types.
6. In the Manage Metadata Types dialog box, select the american-flights_json type.
7. Click OK.
8. Close the project.
Review the API specification and resources for the apdev-flights-ws project
9. Return to the apdev-flights-ws project.
10. Return to mua-flights-api.raml and review the specified response and request types.
11. Locate the files you added to the src/test/resources folder.
12. Locate the file you added to the src/main/java folder.
Create flights_json metadata type
13. Right-click the project and select Mule > Manage Metadata Types.
14. In the Manage Metadata Types dialog box, click the Add button.
15. In the Create new type dialog box, set the type id to flights_json.
16. Click Create type.
17. In the Manage Metadata Types dialog box, set the first type to JSON.
18. In the drop-down menu beneath the type, select Example.
19. Click the browse button and select the flights-example.json file in src/test/resources.
20. In the Manage Metadata Types dialog box, click OK.
21. In the Apply changes dialog box, click Yes.
Locate the new metadata definition file
22. Locate application-types.xml in src/main/resources.
23. Open the file and review the code.
Create flight_json metadata type
24. Right-click the project and select Mule > Manage Metadata Types.
25. In the Manage Metadata Types dialog box, click Add.
26. In the Create new type dialog box, set the type id to flight_json and click Create type.
27. In the Manage Metadata Types dialog box, set the first type to JSON.
28. Select Example and browse to and select the flight-example.json file in src/test/resources.
Create flights_xml metadata type
29. In the Manage Metadata Types dialog box, click Add.
30. In the Create new type dialog box, set the type id to flights_xml and click Create type.
31. In the Apply changes dialog box, click Yes.
32. In the Manage Metadata Types dialog box, set the first type to XML.
33. Select Example and browse to and select the flights-example.xml file in src/test/resources.
Create Flight_pojo metadata type
34. In the Manage Metadata Types dialog box, click the Add button.
35. In the Create new type dialog box, set the type id to Flight_pojo and click Create type.
36. In the Apply changes dialog box, click Yes.
37. In the Manage Metadata Types dialog box, set the first type to Object.
38. In the Data structure section, click the Click here to select an option link.
39. In the drop-down menu that appears, select Java object.
40. In the dialog box that opens, type fli in the Select entries field and then in the list of classes that appears, select Flight – com.mulesoft.training.
41. Click OK.
42. In the Manage Metadata Types dialog box, click OK.
43. In the Apply changes dialog box, click Yes.
Review the metadata definition file
44. Return to application-types.xml in src/main/resources.
45. Close the file.